//
//  UIBarButtonItem+create.m
//  Weibo
//
//  Created by student on 16/4/25.
//  Copyright © 2016年 Mcc. All rights reserved.
//

#import "UIBarButtonItem+create.h"

@implementation UIBarButtonItem (create)
+(UIBarButtonItem *)createBarButtonItem:(NSString *)imageName
                                 target:(id)target
                                 action:(SEL)selector
{
    UIButton *btn=[UIButton buttonWithType:UIButtonTypeCustom];
    [btn setImage:[UIImage imageNamed:imageName] forState:UIControlStateNormal];
    [btn setImage:[UIImage imageNamed:[imageName stringByAppendingString:@"_highlighted"]] forState:UIControlStateHighlighted];
    [btn addTarget:target action:selector forControlEvents:UIControlEventTouchUpInside];
    [btn sizeToFit];
    return [[UIBarButtonItem alloc]initWithCustomView:btn];
}
@end
